package com.zzgele.qmzb.api.utils;

import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by Martin on 2017-07-16.
 */
public class JsonUtil {
    private final static Logger logger = LoggerFactory.getLogger(JsonUtil.class);

    public static boolean isBadJson(String json) {
        return !isGoodJson(json);
    }

    public static boolean isGoodJson(String json) {
        if (StringUtil.isEmpty(json)) {
            return false;
        }
        try {
            JSON.parseObject(json);
            return true;
        } catch (Exception e){
            logger.info("bad json:{}", json);
            return false;
        }
    }
}
